package com.teamsun.mqtt;

import java.io.IOException;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BootServer {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
	
//	
//		MqttServer  mqttServer= new MqttServer();
//		
		ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
		
		
		MqttServer mqttServer=applicationContext.getBean(MqttServer.class);
		

		if(mqttServer==null)
		{
			System.err.print("初始化失败");
			System.exit(-1);
		}
		
		int port=10000;
		if(args!=null){
			if(args.length>0){
				port=Integer.parseInt(args[0]);
			}
			
		}
		
		try {
			mqttServer.start(port);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		
	
		
		
		
	}
	
	

}
